child_process: make the maxBuffer correct with unicode#1902
child_process: make the maxBuffer correct with unicode#1902JacksonTian wants to merge 1 commit intonodejs:masterfrom
Conversation
|
Ref: #1901 |
|
caculate byte length maybe make performance slow. Would like to hear more suggestion. |
|
Ditto on the |
d609ac1 to
d90d98c
Compare
|
Thanks @cjihrig @trevnorris . Use |
lib/child_process.js
Outdated
There was a problem hiding this comment.
According to the docs, the unit of maxBuffer is bytes, so I think these should unconditionally use Buffer.byteLength().
There was a problem hiding this comment.
when don't set the encoding, the chunk is a buffer.
|
@cjihrig updated. |
|
ping @nodejs/collaborators |
|
LGTM |
|
CI is not happy. |
|
oops. err not found in windows.... |
|
the windows doesn't like unicode. hmmm. |
|
I think maybe reached an edge case for windows platform. |
|
Anyone can help me to restart the CI? |
|
The test failures seem to be related to a known issue on Windows - nodejs/node-v0.x-archive#7940. @piscisaureus is this something that can be skipped on Windows during testing? |
|
can we skip the test case for win32? ping @piscisaureus |
|
You can probably skip the test case with something like the crypto skip, but with |
|
anyone can help me to restart the CI? |
|
I think what @piscisaureus is getting at is that partial character sequences throw off the length calculation; the Apart from that stipulation the patch looks correct to me. It's rather inefficient though: we first convert from bytes to characters and then we convert that back to bytes for the length calculation. |
|
@bnoordhuis We can don't set encoding, so don't use |
aa6a9d7 to
8e08e84
Compare
|
I think you will still need a I don't think we can just remove the |
8e08e84 to
0bc6cdd
Compare
0bc6cdd to
8d5a444
Compare
|
With the commit bfb2cd0 be landed, the PR can be implemented more light-weight. |
8d5a444 to
3e22109
Compare
There was a problem hiding this comment.
Can you use assert.strictEqual() here. Also, you can drop the first assertion.
|
LGTM. This should hopefully avoid any encoding issues. @bnoordhuis @piscisaureus @trevnorris thoughts? |
The maxLen just caculate the string length, but to unicode string, the string size is less than buffer size.
3e22109 to
937452c
Compare
|
Would it be possible to get another round of reviews from some combination of @bnoordhuis @piscisaureus and @trevnorris ? It would be nice to see this finally land if the objections have been sufficiently addressed. (And if not, it would be nice to have the objections documented or reiterated.) |
|
Nit: Can you add |
|
Nit: Can you find a way to shorten the first line of the commit message so that it is 50 characters or less? |
|
For the test would it be possible to spawn a child node process and write to its stderr/stdout? That should work for all platforms. |
|
It looks like the test still needs an update. |
|
bfb2cd0 was reverted, this issue needs hold. |
7da4fd4 to
c7066fb
Compare
|
I believe this can be closed now given that #6764 landed. |
The maxLen just caculate the string length, but to unicode string,
the string size is less than buffer size.